<template>
  <div class="search">
    <nav class="searchList-nav" ref="change">
      <div style="margin-top: 20px;">
        <span :class="{isActive: toggle=='Songs'}" @click="handleChangeView('Songs')">歌曲</span>
      </div>
    </nav>
    <component :is="currentView"></component>
  </div>
</template>
<script>
import searchSongs from '@/views/components/search/SearchSongs'
import searchSongLists from '@/views/components/search/SearchSongLists'

export default {
  name: 'search',
  components: {
    searchSongs,
    searchSongLists
  },
  data() {
    return {
      toggle: 'Songs',
      currentView: 'searchSongs'
    }
  },
  methods: {
    //切换组件
    handleChangeView(component) {
      this.currentView = 'search' + component;
      this.toggle = component;
    }
  }
}
</script>
<style lang="scss" scoped>
@import '~@/assets/css/search.scss';
</style>
